package com.yang.SpringTest.annotation.profileLearn;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * <p>ProfileDemoConfig配置类</p>
 *
 * @author By: chengxuyuanshitang
 * Package com.yang.SpringTest.annotation.profileLearn
 * Ceate Time 2024-04-09 17:38
 */
@Profile("development")
@Configuration
@ComponentScan(value = {"com.yang.SpringTest.annotation.profileLearn"})
public class ProfileDemoConfig {

    @Profile("development")
    @Bean("profileBeanDev")
    public ProfileDemo profileBeanDev(){
        return new ProfileDemo("开发环境");
    }
    @Profile("test")
    @Bean("profileBeanTest")
    public ProfileDemo profileBeanTest(){
        return new ProfileDemo("测试环境");
    }
    @Profile("production")
    @Bean("profileBeanProd")
    public ProfileDemo profileBeanProd(){
        return new ProfileDemo("生产环境");
    }
}

